using System;
using System.Collections;
using System.Collections.Generic;
using Prime31;
using UnityEngine;
using UnityEngine.SceneManagement;

public class FlurryWrapper : MonoBehaviour
{
	private static bool isEnabled = true;

	public static long sessionStart;

	private static List<float> _killRates = new List<float>();

	private static List<float> _killRatesTitans = new List<float>();

	private static List<float> _killRatesTanks = new List<float>();

	private static List<int> _avaregeKill = new List<int>();

	public static string EV_LVL_1_10 = " [1-10]";

	public static string EV_LVL_11_20 = " [11-20]";

	public static string EV_POST_TO_FACEBOOK = "Post to FB";

	public static string EV_POST_TO_TWITTER = "Post to TW";

	public static string EV_OPEN_SHOP_M = "Open Shop_Menu";

	public static string EV_OPEN_SHOP_G = "Open Shop_Game";

	public static string EV_LAUNCH_FREEPLAY = "Freeplay";

	public static string EV_LAUNCH_ONLINE = "Launch Online";

	public static string EV_LAUNCH_HERO_ROOM = "Open Hero Room";

	public static string EV_BUY_SKIN = "Buy Skin ";

	public static string EV_LAUNCH_QUICKGAME = "Launch Quickgame";

	public static string EV_LAUNCH_CREATEGAME = "Launch CreateGame";

	public static string EV_LAUNCH_ROOM = "Launch Room";

	public static string EV_BUY_ITEM = "Shop Purchases Total ";

	public static string EV_BUY_ITEM_LEAGUE = "Shop Purchases on league ";

	public static string EV_PAING = " (Paing user)";

	public static string EV_NOT_PAING = " (Not paing user)";

	public static string EV_REACHED_LEVEL = "Reached level";

	public static string EV_NEW_PLAYERS = "New Players";

	public static string EV_PAYMENT_DISTRIBUTION = "Payment Distribution";

	public static string EV_NEW_PAYING_PLAYERS = "New Paying Players";

	public static string EV_TUTORIAL_CLOSE = "Tutorial";

	public static string EV_LEVEL_DISRIBUTION = "Level Distribution";

	public static string EV_FIRS_SHOP_FOR_PURCHASED_CASH = "First Shop for purchased money (cash)";

	public static string EV_FIRS_SHOP_FOR_PURCHASED_GOLD = "First Shop for purchased money (gold)";

	public static string EV_FIRST_IN_APP_PURCHASE_BY_LEVEL = "First in-app purchase";

	public static string EV_TOP_USED_WEAPON_MODES = "Top Used Weapon (Modes)";

	public static string EV_PVP_MAP_METRIX = "PVP maps metrix";

	public static string EV_GAME_MODES = "Games Modes";

	public static string EV_PAYMENT_BY_IOS_DEVICES = "Payment distribution by ios devices";

	public static string EV_GAME_SESSION_ON_LEVEL = "Average Game Session on Level";

	public static string EV_CASH_COLLECTED_ON_LEVEL = "Average Cash collected on Level";

	public static string EV_AVERAGE_COLLECTED_CASH = "Average Collected Cash to the end of Level";

	public static string EV_AVERAGE_COLLECTED_GOLD = "Average Collected Gold to the end of Level";

	public static string EV_CURENCY_PAYMENT_ON_GAME_MODE = "Currency Payment on Game Mode";

	public static string EV_CURENCY_IN_APPS_PURCHASES_ON_GAME_MODE = "Currency in-Apps purchases on Game Mode";

	public static string EV_DAILY_CURRENCY_STATS = "Daily currency stats";

	public static string EV_DAILY_MARATHON_STATS = "Daily marathon stats";

	public static string EV_QUESTS_FINISHED = "Quests Finished";

	public static string EV_PLAYER_KILLRATE = "Player Kill Rate";

	public static string EV_X3_TRANSATION = "x3 Transition";

	public static string EV_ACHIVEMENTS_COMPLETE = "Achievments Complete";

	public static string EV_CASH_SPENDING_BY_TIER = "Cash Spending By Tier";

	public static string EV_GOLD_SPENDING_BY_TIER = "Gold Spending By Tier";

	public static string EV_CONTROLL_CHANGES = "Custom Constrols Changes";

	public static string EV_EVENT_COMPLETE = "Events Complete";

	public static string EV_HIDEN_COINS = "Hidden Coins Finded";

	public static string EV_MULTIPLAYER_MODE_RATING = "Multiplayer Mode Rating";

	public static string EV_CAMERA_TYPE = "Camera selected type of control";

	public static string EV_CAR_CONTROL_TYPE = "Car selected type of control";

	public static string EV_ITEM_QUANTITY_BY_TIER = "Items Quantity Buying By Tier";

	public static string EV_ELAPSED_TIME_LEVEL = "Elapsed Time To Each Level";

	public static string EV_CONVERSION_BY_KILL_RATE = "Conversion Buy By KillRate";

	public static string EV_CHEATING = "Cheating";

	public static string EV_AVAREGE_KILL = "Avarege Kill";

	public static string EV_ADV_BANER = "Adv banner";

	public static string EV_REPUTATION_TUTRORIAL = "Reputation tutrorial";

	public static string EV_AVERAGE_DISTRICTS_CAPTURED = "Average districts captured per player";

	public static string EV_MOST_POPULAR_DISTRICTS = "Most popular districts to capture";

	public static string EV_AVERAGE_TIME_TO_FULLY_CAPTURE_DISTRICT = "Average time to fully capture district";

	public static string EV_PVP_BATTLES_WITH_BONUS_REPUTATION_PLACES = "Pvp battles with bonus reputation places";

	public static string EV_CHECKING_DISTRICTS_MAP_PER_SESSION = "Checking districts map per session";

	public static string EV_CITY_SPAWN_USAGE = "City spawn usage";

	public static string EV_TIME_IN_GAME_MODES_BY_LEAGUE = "Time in game modes by league ";

	public static string EV_TIME_IN_PVP_MAPS_BY_LVL = "Time in pvp maps by level";

	public static string EV_TIME_TOTAL_AMMOUNT_BU_MODES_AND_PVP_MAPS = "Time total amount by modes and pvp maps";

	public static string EV_COUNT_SESSION_REPUTATION_RECIEVED_REWARD = "Session reputation recieved reward count";

	public static string EV_CHESTS_OPEN_TYPE = "Chests_open_type";

	public static string EV_CHESTS_QUANTITY = "Chests_quantity";

	public static string EV_REPUTATION_RETURN_TO_LOBBY_STAGE_OFFLINE = "Reputation_return_to_lobby_stage_offline";

	public static string EV_REPUTATION_RETURN_TO_LOBBY_STAGE_ONLINE = "Reputation_return_to_lobby_stage_online";

	public static string EV_MODES_LEAVES_RATING = "Modes_leaves_rating";

	public static string EV_CUPS_PER_SESSION = "Cups_per_session";

	public static string EV_TANKS_MODE_KILLRATE = "Tanks_mode_killrate";

	public static string EV_ZOMBIE_MODE_STATS = "Zombie_mode_stats";

	public static string EV_ROUNDS_COUNT_BY_MODES = "Rounds_count_by_modes";

	public static string EV_TDM_VICTORY_CONDITION = "Tdm_victory_condition";

	public static string EV_SPECIAL_OFFER_SALES = "Special_offer_sales";

	public static string EV_COPS_AND_ROBBERS_STATS = "Cops_and_robbers_stats";

	public static string EV_SKYBLOCKS_STATS = "Skyblocks_stats";

	public static string EV_RECOMENDED_ITEMS_FOR_MODE = "Recomended_items_for_mode";

	public static string EV_SALES_ITEMS = "Sales_items";

	public static string EV_PING_ROCKET_LEAGUE = "Ping_rocket_league";

	public static string EV_PIXELMON_VICTORY = "Pixelmon_stats";

	public static string EV_TITANFALL_STATS = "TitanFall_stats";

	public static string EV_STARTER_PACKS_STATS = "Starter_packs";

	public static string EV_DAILY_EARNED_CASH = "Daily_earned_cash_in_sandbox_by_active_users";

	public static string EV_DAILY_EARNED_GOLD = "Daily_earned_gold_in_sandbox_by_active_users";

	public static string EV_SHOP_PURCHASES_BY_ACTIVE_USERS = "Shop Purchases by active users";

	public static string EV_DAILY_EARNED_CASH_PER_DAY = "EV_DAILY_EARNED_CASH_PER_DAY";

	public static string EV_DAILY_EARNED_GOLD_PER_DAY = "EV_DAILY_EARNED_GOLD_PER_DAY";

	public static bool activePlayer = false;

	private int _daysToZeroActivePlayer = 30;

	private string _keyLastOpenApplication = "keyLastOpenApplication";

	public static string keyDayCash = "keyDayCash";

	public static string keyDayGold = "keyDayGold";

	public static long CurrentUnixTime
	{
		get
		{
			DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
			return (long)(DateTime.UtcNow - dateTime).TotalSeconds;
		}
	}

	private void Start()
	{
		UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
		StartCoroutine(CheckIsActivePlayer());
		InitializeFlurry();
		Save.SaveLong(settings.keyStartSesionTime, CurrentUnixTime);
		sessionStart = CurrentUnixTime;
		int[] array = Load.LoadIntArray(EV_AVAREGE_KILL);
		if (array != null)
		{
			_avaregeKill.AddRange(array);
		}
		float[] array2 = Load.LoadFloatArray(EV_PLAYER_KILLRATE);
		if (array2 != null)
		{
			_killRates.AddRange(array2);
		}
		float[] collection = Load.LoadFloatArray(EV_PLAYER_KILLRATE + "_Tank");
		if (array2 != null)
		{
			_killRatesTanks.AddRange(collection);
		}
		float[] collection2 = Load.LoadFloatArray(EV_PLAYER_KILLRATE + "_Titan");
		if (array2 != null)
		{
			_killRatesTitans.AddRange(collection2);
		}
		StartCoroutine(CheckPlayerGameMod());
	}

	private IEnumerator CheckIsActivePlayer()
	{
		while (!JSONManager.Instance.ServerTimeLoad())
		{
			yield return new WaitForSeconds(1f);
		}
		if (CryptoPlayerPrefs.HasKey(_keyLastOpenApplication))
		{
			int lastOpen = BCWStorage.Get<int>(_keyLastOpenApplication);
			if (lastOpen + settings.DayToSeconds(_daysToZeroActivePlayer) > JSONManager.Instance.GetServerTime())
			{
				activePlayer = true;
			}
		}
		BCWStorage.Set(_keyLastOpenApplication, JSONManager.Instance.GetServerTime());
	}

	private IEnumerator CheckPlayerGameMod()
	{
		Dictionary<string, string> parameters = new Dictionary<string, string>();
		while (true)
		{
			yield return new WaitForSeconds(60f);
			if (GameController.instance != null)
			{
				parameters.Clear();
				string levelNameLowerCase2 = SceneManager.GetActiveScene().name.ToLower();
				if (!levelNameLowerCase2.Contains("lobby"))
				{
					if (settings.offlineMode)
					{
						parameters.Add("Offline_sandbox", (CupsManager.CurrentLeagueIndex + 1).ToString());
					}
					else if (GameController.instance.curTypeGame == TypeGame.TDM)
					{
						parameters.Add("Team_deathmatch", (CupsManager.CurrentLeagueIndex + 1).ToString());
					}
					else if (GameController.instance.curTypeGame == TypeGame.race)
					{
						parameters.Add("Race", (CupsManager.CurrentLeagueIndex + 1).ToString());
					}
					else if (GameController.instance.curTypeGame == TypeGame.tanks)
					{
						parameters.Add("Tanks", (CupsManager.CurrentLeagueIndex + 1).ToString());
					}
					else if (GameController.instance.curTypeGame == TypeGame.Zombe)
					{
						parameters.Add("Zombie", (CupsManager.CurrentLeagueIndex + 1).ToString());
					}
					else if (GameController.instance.curTypeGame == TypeGame.SkyBlock)
					{
						parameters.Add("SkyBlock", (CupsManager.CurrentLeagueIndex + 1).ToString());
					}
					else if (GameController.instance.curTypeGame == TypeGame.CopsAndRobbers)
					{
						parameters.Add("Cops And Robbers", (CupsManager.CurrentLeagueIndex + 1).ToString());
					}
					else if (GameController.instance.curTypeGame == TypeGame.RocketLeague)
					{
						parameters.Add("Rocket League", (CupsManager.CurrentLeagueIndex + 1).ToString());
					}
					else if (GameController.instance.curTypeGame == TypeGame.WalkingRobots)
					{
						parameters.Add("Walking Robots", (CupsManager.CurrentLeagueIndex + 1).ToString());
					}
					else
					{
						parameters.Add("Online_sandbox", (CupsManager.CurrentLeagueIndex + 1).ToString());
					}
					LogEvent(EV_TIME_IN_GAME_MODES_BY_LEAGUE, parameters);
				}
			}
			if (!(GameController.instance != null))
			{
				continue;
			}
			parameters.Clear();
			string levelNameLowerCase = SceneManager.GetActiveScene().name.ToLower();
			if (!levelNameLowerCase.Contains("lobby"))
			{
				if (settings.offlineMode)
				{
					parameters.Add("Time in game modes", "Offline_sandbox");
				}
				else if (GameController.instance.curTypeGame == TypeGame.TDM)
				{
					parameters.Add("Time in game modes", "Team_deathmatch");
				}
				else if (GameController.instance.curTypeGame == TypeGame.race)
				{
					parameters.Add("Time in game modes", "Race");
				}
				else if (GameController.instance.curTypeGame == TypeGame.tanks)
				{
					parameters.Add("Time in game modes", "Tanks");
				}
				else if (GameController.instance.curTypeGame == TypeGame.Zombe)
				{
					parameters.Add("Time in game modes", "Zombie");
				}
				else if (GameController.instance.curTypeGame == TypeGame.SkyBlock)
				{
					parameters.Add("Time in game modes", "SkyBlock");
				}
				else if (GameController.instance.curTypeGame == TypeGame.CopsAndRobbers)
				{
					parameters.Add("Time in game modes", "Cops And Robbers");
				}
				else if (GameController.instance.curTypeGame == TypeGame.RocketLeague)
				{
					parameters.Add("Time in game modes", "Rocket League");
				}
				else if (GameController.instance.curTypeGame == TypeGame.Pixelmon)
				{
					parameters.Add("Time in game modes", "Pixelmon");
				}
				else if (GameController.instance.curTypeGame == TypeGame.WalkingRobots)
				{
					parameters.Add("Time in game modes", "Walking Robots");
				}
				else if (GameController.instance.curTypeGame == TypeGame.TitanfallV2)
				{
					parameters.Add("Time in game modes", "Titanfall V2");
				}
				else
				{
					parameters.Add("Time in game modes", "Online_sandbox");
				}
				LogEvent(EV_TIME_TOTAL_AMMOUNT_BU_MODES_AND_PVP_MAPS, parameters);
			}
		}
	}

	private void OnApplicationPause(bool pauseStatus)
	{
		Dictionary<string, string> dictionary = new Dictionary<string, string>();
		if (pauseStatus)
		{
			dictionary.Add("Tier " + CupsManager.CurrentTier, TimeSpend(CurrentUnixTime - Load.LoadLong(settings.keyStartSesionTime)));
			LogEvent(EV_GAME_SESSION_ON_LEVEL + LevelForFlurry(), dictionary);
		}
		if (pauseStatus)
		{
			if (!Load.LoadBool("NormalSession"))
			{
				Save.SaveBool("NormalSession", true);
				Save.SaveInt("OldCam", 99);
				Save.SaveInt("OldCarControll", 99);
			}
			long num = CurrentUnixTime - sessionStart;
			if (num < int.MaxValue)
			{
				BCWStorage.Set(EV_ELAPSED_TIME_LEVEL, (int)num, true);
			}
			dictionary.Clear();
			dictionary.Add("KillRate " + GetAverageKillRate(), GetPayingSuffix());
			LogEvent(EV_CONVERSION_BY_KILL_RATE, dictionary);
			dictionary.Clear();
			foreach (int value in Enum.GetValues(typeof(GotchaChestType)))
			{
				dictionary.Add(((GotchaChestType)value).ToString(), BCWStorage.Get<int>(string.Concat((GotchaChestType)value, "_count")).ToString());
			}
			LogEvent(EV_CHESTS_QUANTITY, dictionary);
			dictionary.Clear();
			dictionary.Add((CupsManager.CurrentLeagueIndex + 1).ToString(), CupsPerSession(CupsManager.SesionCupsCount));
			LogEvent(EV_CUPS_PER_SESSION, dictionary);
			dictionary.Clear();
			dictionary.Add("Player_Kill_Rate", GetAverageKillRate());
			LogEvent(EV_PLAYER_KILLRATE, dictionary);
			Save.SaveFloatArray(EV_PLAYER_KILLRATE, _killRates.ToArray());
			dictionary.Clear();
			dictionary.Add("Titan_Kill_Rate", GetAverageKillRateTitans());
			LogEvent(EV_PLAYER_KILLRATE, dictionary);
			Save.SaveFloatArray(EV_PLAYER_KILLRATE + "_Titan", _killRatesTitans.ToArray());
			dictionary.Clear();
			dictionary.Add("Tank_Kill_Rate", GetAverageKillRateTank());
			LogEvent(EV_PLAYER_KILLRATE, dictionary);
			Save.SaveFloatArray(EV_PLAYER_KILLRATE + "_Tank", _killRatesTanks.ToArray());
			PlayerPrefs.Save();
		}
		else
		{
			sessionStart = CurrentUnixTime;
		}
	}

	private void InitializeFlurry()
	{
		string empty = string.Empty;
		empty = "QFYM7YSKSCJ8T9RZ8NMX";
		if (!string.IsNullOrEmpty(empty))
		{
			FlurryAnalytics.startSession(empty);
			FlurryAnalytics.setUserID(SystemInfo.deviceUniqueIdentifier);
		}
		BCWDebug.Log("Flurry start session Android");
		FlurryAnalytics.setLogEnabled(BCWDebug.isDebugBuild);
	}

	private void InitializeDevToDev()
	{
	}

	private void OnDestroy()
	{
	}

	public static string SubCategoryNameForFlurry(Product product)
	{
		if (product.categoryName == "Armor")
		{
			return "Armor";
		}
		if (product.categoryName == "Looks" && product.subCategoryName == "Special")
		{
			return "SkinsSpecial";
		}
		return product.subCategoryName;
	}

	public static string GetEventName(string eventName)
	{
		return eventName + GetPayingSuffix();
	}

	public static string GetPayingSuffix(bool paingCountSuffix = false)
	{
		if (!IsPayingUser())
		{
			return " (Non Paying)";
		}
		return " (Paying)";
	}

	public static bool IsPayingUser()
	{
		return Load.LoadBool(settings.keyPayment);
	}

	public static bool IsPayingNUser(int num)
	{
		return IsPayingUser() && GetDollarsSpent() > (float)num;
	}

	public static float GetDollarsSpent()
	{
		return Load.LoadFloat(settings.keyAllPayments);
	}

	public static void LogEvent(string eventName, Dictionary<string, string> parameters)
	{
		if (isEnabled)
		{
			FlurryAnalytics.logEvent(eventName, parameters, false);
		}
	}

	public static void LogEvent(string eventName)
	{
		if (isEnabled)
		{
			FlurryAnalytics.logEvent(eventName, false);
		}
	}

	public static string LevelForFlurry()
	{
		return CupsManager.CurrentTier.ToString();
	}

	public static string TimeSpend(long seconds)
	{
		if (seconds <= 30)
		{
			return "< 30 sec";
		}
		if (seconds / 60 <= 3)
		{
			return "30 sec - 3 min";
		}
		if (seconds / 60 <= 5)
		{
			return "3 min - 5 min";
		}
		if (seconds / 60 <= 10)
		{
			return "5 min - 10 min";
		}
		if (seconds / 60 <= 15)
		{
			return "10 min - 15 min";
		}
		if (seconds / 60 <= 30)
		{
			return "15 min - 30 min";
		}
		if (seconds / 60 <= 60)
		{
			return "30 min - 60 min";
		}
		return "60 min <";
	}

	public static string CashCollected(int cash)
	{
		if (cash <= 500)
		{
			return "< 500 cash";
		}
		if (cash <= 1000)
		{
			return "500 cash - 1000 cash";
		}
		if (cash <= 2000)
		{
			return "1000 cash - 2000 cash";
		}
		if (cash <= 3000)
		{
			return "2000 cash - 3000 cash";
		}
		if (cash <= 4000)
		{
			return "3000 cash - 4000 cash";
		}
		if (cash <= 5000)
		{
			return "4000 cash - 5000 cash";
		}
		if (cash <= 7000)
		{
			return "5000 cash - 10000 cash";
		}
		if (cash <= 10000)
		{
			return "7000 cash - 10000 cash";
		}
		if (cash <= 15000)
		{
			return "1000 cash - 15000 cash";
		}
		if (cash <= 20000)
		{
			return "15000 cash - 20000 cash";
		}
		if (cash <= 30000)
		{
			return "20000 cash - 30000 cash";
		}
		return "30000 cash <";
	}

	public static string GetPingForFlurry(int ping)
	{
		if (ping < 50)
		{
			return "0 - 50";
		}
		if (ping <= 100)
		{
			return "50 - 100";
		}
		if (ping <= 200)
		{
			return "100 - 200";
		}
		if (ping <= 300)
		{
			return "200 - 300";
		}
		if (ping <= 400)
		{
			return "300 - 400";
		}
		if (ping <= 500)
		{
			return "400 - 500";
		}
		if (ping <= 600)
		{
			return "500 - 600";
		}
		if (ping <= 700)
		{
			return "600 - 700";
		}
		if (ping <= 800)
		{
			return "700 - 800";
		}
		if (ping <= 900)
		{
			return "800 - 900";
		}
		if (ping <= 1000)
		{
			return "900 - 1000";
		}
		return "1000 - ...";
	}

	public static string CashCollectedAll(int cash)
	{
		if (cash <= 1000)
		{
			return "< 1000 cash";
		}
		if (cash <= 3000)
		{
			return "1000 cash - 3000 cash";
		}
		if (cash <= 7000)
		{
			return "3000 cash - 7000 cash";
		}
		if (cash <= 15000)
		{
			return "7000 cash - 15000 cash";
		}
		if (cash <= 30000)
		{
			return "15000 cash - 30000 cash";
		}
		if (cash <= 50000)
		{
			return "30000 cash - 50000 cash";
		}
		if (cash <= 100000)
		{
			return "50000 cash - 100000 cash";
		}
		if (cash <= 200000)
		{
			return "100000 cash - 200000 cash";
		}
		if (cash <= 500000)
		{
			return "200000 cash - 500000 cash";
		}
		return "500000 cash <";
	}

	public static string GoldCollectedAll(int gold)
	{
		if (gold <= 5)
		{
			return "< 5 gold";
		}
		if (gold <= 10)
		{
			return "5 gold - 10 gold";
		}
		if (gold <= 15)
		{
			return "10 gold - 15 gold";
		}
		if (gold <= 25)
		{
			return "15 gold - 25 gold";
		}
		if (gold <= 50)
		{
			return "25 gold - 50 gold";
		}
		if (gold <= 100)
		{
			return "50 gold - 100 gold";
		}
		if (gold <= 150)
		{
			return "100 gold - 150 gold";
		}
		if (gold <= 200)
		{
			return "150 gold - 200 gold";
		}
		if (gold <= 300)
		{
			return "200 gold - 300 gold";
		}
		return "300 gold <";
	}

	public static string CupsPerSession(int gainedCups)
	{
		if (gainedCups < 0)
		{
			return "< 0";
		}
		if (gainedCups <= 150)
		{
			return "0 - 150";
		}
		if (gainedCups <= 350)
		{
			return "151 - 350";
		}
		if (gainedCups <= 600)
		{
			return "351 - 600";
		}
		if (gainedCups <= 900)
		{
			return "601 - 900";
		}
		if (gainedCups <= 1500)
		{
			return "901 - 1500";
		}
		return "> 1500";
	}

	public static string GetCurrentGameMode()
	{
		if (SceneManager.GetActiveScene().name == "Lobby")
		{
			return "Lobby";
		}
		if (settings.offlineMode)
		{
			return "Adventure";
		}
		switch (GameController.instance.curTypeGame)
		{
		case TypeGame.normal:
			return "Sandbox";
		case TypeGame.race:
			return "Race";
		case TypeGame.tanks:
			return "Tanks";
		case TypeGame.TDM:
			return "Team Deathmatch";
		case TypeGame.SkyBlock:
			return "SkyBlock";
		case TypeGame.CopsAndRobbers:
			return "CopsAndRobbers";
		case TypeGame.WalkingRobots:
			return "Titanfall";
		case TypeGame.Pixelmon:
			return "Pixelmon";
		case TypeGame.RocketLeague:
			return "RocketLeague";
		case TypeGame.Zombe:
			return "Zombie";
		default:
			return "Other";
		}
	}

	public static string GetCurrentNetworkType()
	{
		if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
		{
			return "WI-FI";
		}
		return "3G";
	}

	public static string AdvBanerLoadingTime(long seconds)
	{
		if (seconds <= 1)
		{
			return "< 1 sec";
		}
		if (seconds <= 2)
		{
			return "1 sec - 2 sec";
		}
		if (seconds <= 4)
		{
			return "2 sec - 4 sec";
		}
		if (seconds <= 6)
		{
			return "4 sec - 6 sec";
		}
		if (seconds <= 10)
		{
			return "6 sec - 10 sec";
		}
		if (seconds <= 15)
		{
			return "10 sec - 15 sec";
		}
		if (seconds <= 30)
		{
			return "15 sec - 30 sec";
		}
		return "30 sec < ";
	}

	public static string CashSpending(int cash)
	{
		if (cash <= 1000)
		{
			return "<1000";
		}
		if (cash <= 5000)
		{
			return "1000-5000";
		}
		if (cash <= 10000)
		{
			return "5000-10000";
		}
		if (cash <= 20000)
		{
			return "10000-20000";
		}
		if (cash <= 50000)
		{
			return "20000-50000";
		}
		return ">50000";
	}

	public static string GoldSpending(int gold)
	{
		if (gold <= 20)
		{
			return "<20";
		}
		if (gold <= 100)
		{
			return "20-100";
		}
		if (gold <= 200)
		{
			return "100-200";
		}
		if (gold <= 400)
		{
			return "200-400";
		}
		if (gold <= 1000)
		{
			return "400-1000";
		}
		return ">1000";
	}

	public static string ItemsQuantity(int count)
	{
		if (count == 0)
		{
			return "0";
		}
		if (count == 1)
		{
			return "1";
		}
		if (count <= 3)
		{
			return "2-3";
		}
		if (count <= 5)
		{
			return "4-5";
		}
		return "6+";
	}

	public static string ElapsedTime(long seconds)
	{
		if (seconds <= 1800)
		{
			return "< 30 min";
		}
		if (seconds <= 3600)
		{
			return "30 min - 1 hour";
		}
		if (seconds <= 7200)
		{
			return "1 hour - 2 hour";
		}
		if (seconds <= 10800)
		{
			return "2 hour - 3 hour";
		}
		if (seconds <= 18000)
		{
			return "3 hour - 5 hour";
		}
		if (seconds <= 25200)
		{
			return "5 hour - 7 hour";
		}
		if (seconds <= 36000)
		{
			return "7 hour - 10 hour";
		}
		return ">10 hour ";
	}

	public static void UpdateKillRate(float killRate)
	{
		if (GameController.instance != null && GameController.instance.curTypeGame == TypeGame.WalkingRobots)
		{
			_killRatesTitans.Add(killRate);
			if (_killRatesTitans.Count > 10)
			{
				_killRatesTitans.RemoveAt(0);
			}
		}
		else if (GameController.instance != null && GameController.instance.curTypeGame == TypeGame.tanks)
		{
			_killRatesTanks.Add(killRate);
			if (_killRatesTanks.Count > 10)
			{
				_killRatesTanks.RemoveAt(0);
			}
		}
		else if (GameController.instance != null && GameController.instance.curTypeGame != TypeGame.TitanfallV2)
		{
			_killRates.Add(killRate);
			if (_killRates.Count > 10)
			{
				_killRates.RemoveAt(0);
			}
		}
	}

	public static string GetAverageKillRate()
	{
		float num = 0f;
		foreach (float killRate in _killRates)
		{
			float num2 = killRate;
			num += num2;
		}
		return KillRate(num / (float)_killRates.Count);
	}

	public static string GetAverageKillRateTank()
	{
		float num = 0f;
		foreach (float killRatesTitan in _killRatesTitans)
		{
			float num2 = killRatesTitan;
			num += num2;
		}
		return KillRate(num / (float)_killRatesTitans.Count);
	}

	public static string GetAverageKillRateTitans()
	{
		float num = 0f;
		foreach (float killRatesTank in _killRatesTanks)
		{
			float num2 = killRatesTank;
			num += num2;
		}
		return KillRate(num / (float)_killRatesTanks.Count);
	}

	private static string KillRate(float killrate)
	{
		if (killrate <= 0.4f)
		{
			return "< 0.4";
		}
		if (killrate <= 0.8f)
		{
			return "0.4 - 0.8";
		}
		if (killrate <= 1.2f)
		{
			return "0,8 - 1,2";
		}
		if (killrate <= 1.6f)
		{
			return "1,2 - 1,6";
		}
		if (killrate <= 3f)
		{
			return "1,6 - 3";
		}
		if (killrate <= 5f)
		{
			return "3 - 5";
		}
		return ">5";
	}

	public static void UpdateAvaregeKill(int kill)
	{
		_avaregeKill.Add(kill);
		if (_avaregeKill.Count > 15)
		{
			_avaregeKill.Remove(0);
		}
		Save.SaveIntArray(EV_AVAREGE_KILL, _avaregeKill.ToArray());
	}

	public static string GetAvaregeKill()
	{
		float num = 0f;
		foreach (int item in _avaregeKill)
		{
			num += (float)item;
		}
		return (num / (float)_avaregeKill.Count).ToString("0.0");
	}

	public static string TankKillRate(float killrate)
	{
		if (killrate <= 0.4f)
		{
			return "< 0.4";
		}
		if (killrate <= 0.8f)
		{
			return "0.4 - 0.8";
		}
		if (killrate <= 1.2f)
		{
			return "0,8 - 1,2";
		}
		if (killrate <= 1.6f)
		{
			return "1,2 - 1,6";
		}
		return ">1,6";
	}

	public static string DividedRangesDistrictMapOpen(int cnt)
	{
		if (cnt == 1)
		{
			return "1";
		}
		if (cnt < 4)
		{
			return "2-3";
		}
		if (cnt < 6)
		{
			return "4-5";
		}
		return "6+";
	}

	public static string DividedRangesDistrictCaptured(int cnt)
	{
		if (cnt < 3)
		{
			return "0-2";
		}
		if (cnt < 5)
		{
			return "3-4";
		}
		if (cnt < 7)
		{
			return "5-6";
		}
		if (cnt < 9)
		{
			return "7-8";
		}
		return "9+";
	}

	public static string MoneyForSandbox(int money)
	{
		if (money < 2000)
		{
			return "2000";
		}
		if (money < 3000)
		{
			return "3000";
		}
		if (money < 10000)
		{
			return "10000";
		}
		if (money < 20000)
		{
			return "20000";
		}
		if (money < 30000)
		{
			return "30000";
		}
		if (money < 40000)
		{
			return "40000";
		}
		if (money < 50000)
		{
			return "50000";
		}
		return "50000+";
	}

	public static string GoldForSandbox(int gold)
	{
		if (gold < 3)
		{
			return "3";
		}
		if (gold < 10)
		{
			return "10";
		}
		if (gold < 20)
		{
			return "20";
		}
		if (gold < 50)
		{
			return "50";
		}
		if (gold < 100)
		{
			return "100";
		}
		if (gold < 200)
		{
			return "200";
		}
		if (gold < 300)
		{
			return "300";
		}
		return "300+";
	}

	public static string MoneyForSandboxDay(int money)
	{
		if (money < 3000)
		{
			return "3000";
		}
		if (money < 5000)
		{
			return "5000";
		}
		if (money < 10000)
		{
			return "10000";
		}
		if (money < 20000)
		{
			return "20000";
		}
		if (money < 35000)
		{
			return "35000";
		}
		if (money < 60000)
		{
			return "60000";
		}
		if (money < 80000)
		{
			return "80000";
		}
		return "80000+";
	}

	public static string GoldForSandboxDay(int gold)
	{
		if (gold < 10)
		{
			return "10";
		}
		if (gold < 30)
		{
			return "30";
		}
		if (gold < 60)
		{
			return "60";
		}
		if (gold < 100)
		{
			return "100";
		}
		if (gold < 200)
		{
			return "200";
		}
		if (gold < 350)
		{
			return "350";
		}
		if (gold < 500)
		{
			return "500";
		}
		return "500+";
	}

	public static string TimeForSandbox(int seconds)
	{
		if (seconds < settings.MinutesToSeconds(10))
		{
			return "10min";
		}
		if (seconds < settings.MinutesToSeconds(20))
		{
			return "20min";
		}
		if (seconds < settings.MinutesToSeconds(40))
		{
			return "40min";
		}
		if (seconds < settings.MinutesToSeconds(60))
		{
			return "60min";
		}
		if (seconds < settings.MinutesToSeconds(120))
		{
			return "120min";
		}
		return "120+";
	}

	public static string GetProductCategotyForFlurry(Product product)
	{
		if (product.subCategoryName.Equals("Melee"))
		{
			return "melee";
		}
		if (product.subCategoryName.Equals("Rifles"))
		{
			return "primary";
		}
		if (product.subCategoryName.Equals("Special"))
		{
			return "special";
		}
		if (product.subCategoryName.Equals("Gear"))
		{
			return "gears";
		}
		if (product.subCategoryName.Equals("Rides"))
		{
			return "cars";
		}
		if (product.subCategoryName.Equals("Guns"))
		{
			return "pistols";
		}
		if (product.categoryName.Equals("Looks"))
		{
			return "skins";
		}
		if (product.categoryName.Equals("Armor"))
		{
			return "armor";
		}
		if (product.categoryName.Equals("Upgrades"))
		{
			return "car_upgrade";
		}
		return string.Empty;
	}
}
